package org.gstreamer.java.runtime;

public class NativeUtil {

	public static String getenv(String name) {
		return System.getProperty("os.name").startsWith("Windows") ? CrtLibrary.INSTANCE
				.getenv(name)
				: CLibrary.INSTANCE.getenv(name);
	}

	public static void setenv(String name, String value) {
		if (System.getProperty("os.name").startsWith("Windows")) {
			String envstring = name + "=" + value;
			CrtLibrary.INSTANCE._putenv(envstring);
		} else {
			CLibrary.INSTANCE.setenv(name, value, 1);
		}
	}
	
	public static void unsetenv(String name){
		if (System.getProperty("os.name").startsWith("Windows")) {
			CrtLibrary.INSTANCE._putenv(name + "=");
		} else {
			CLibrary.INSTANCE.unsetenv(name);
		}
	}

}
